package com.szrt.oa.actor.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.szrt.oa.actor.entity.ActorEntity;
import com.szrt.oa.actor.service.ActorService;

@Controller
@RequestMapping("/actor")
public class ActorController {
	
	
	@Autowired
	private ActorService  service;
	
	
	
	// http://localhost:8090/ssm/actor/add.do?teacherName=ccc&teacherAge=22
	@RequestMapping("/add")
	public  String abc(ActorEntity entity) throws Exception{
		System.out.println("进入了controller....");
		service.insert(entity);
		return "success"; 
	}
	
	
	
	//http://localhost:8090/ssm/actor/list.do
	@RequestMapping("/list")
	@ResponseBody
	public  List<ActorEntity> findAll() throws Exception{
		System.out.println("进入了controller list....");
		List<ActorEntity> list = service.findAll();
		return list; 
	}
	
	
	
	
	
	
	
	

}
